/*
 * @(#)AuditEventService.java
 * Date 2013-11-01
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.atna.service.es;

import javax.enterprise.inject.Alternative;

import javax.faces.bean.ApplicationScoped;

import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import us.hornerscorners.lamppost.atna.service.IAuditEventService;

import us.hornerscorners.lamppost.exception.ServiceActionException;

import us.hornerscorners.lamppost.ihecommon.service.ElasticSearchSource;

import us.hornerscorners.lamppost.model.audit.AuditEvent;


/**
 * Class description
 *
 *
 * @version        v1.0, 2013-11-01
 * @author         Jim Horner
 */
@Alternative
@ApplicationScoped
public class AuditEventService implements IAuditEventService {

    /** Field description */
    private final Logger logger = LoggerFactory.getLogger(getClass());

    /** Field description */
    @Inject
    private ElasticSearchSource source;

    /**
     * Constructs ...
     *
     */
    public AuditEventService() {
        super();
    }

    /**
     * Method description
     *
     *
     * @param event
     *
     * @throws ServiceActionException
     */
    @Override
    public void recordAuditEvent(AuditEvent event) throws ServiceActionException {

        this.source.writePersistable(event);
    }
}
